<style>
    .formpost input {
        margin: 15px auto;
        border: 0;
        border-bottom: 1px solid black;
        border-color: #ccc;
        height: 40px;
    }
</style>
<nav id="top" class="top" style="height: 150px;background: #fff;border-bottom: 1px solid #F2F2F2;">
    <div class="box">
        <div class="box_dao">
            <span>
                <img src="__STATIC__/assets/images/dizhi.png" alt="">
                <span style="color: #e83f44;">&nbsp;武汉站</span>
                <a href="">
                    <切换>
                </a>
                <img src="__STATIC__/assets/images/tel.png" alt="">
                <span>400-900-2355</span>
            </span>


            <span class="nav pull-right">

                {if condition="(!empty($Think.session.member_phone))"}
                <img src="__STATIC__/assets/images/zhanghu.png" alt="" style="margin-right: 5px;">
                <a href="{:url('Core/index')}">我的账户</a>
                {else /} {if condition="(!empty($Think.session.seller_id))"}
                <img src="__STATIC__/assets/images/zhanghu.png" alt="">
                <a href="{:url('Core/index')}">我的账户</a>
                <img src="__STATIC__/assets/images/dingdan.png" alt="">
                <a href="{:url('Index/generate')}">生成订单</a>
                {/if} {/if}





                <span>
                    {if condition="(empty($Think.session.member_phone) && empty($Think.session.seller_id))"}
                    <img src="__STATIC__/assets/images/login_logo.png" alt="" style="margin-right:10px;">
                    <a style="margin: 0;cursor:pointer" onclick="login()">登录</a>
                    <span>/</span>
                    <a style="margin: 0;cursor:pointer" onclick="register_to()">注册</a>
                    {else /} {if condition="(!empty($Think.session.member_phone))"}
                    <span style="color:#e83f44">欢迎您！</span>{$Think.session.member_phone}
                    <a style="margin: 0;cursor:pointer;color:#e83f44;" onclick="delselling()">注销！</a>
                    {else /} {if condition="(!empty($Think.session.seller_id))"}
                    <span style="color:#e83f44">欢迎您！</span>{$Think.session.seller_name}
                    <a style="margin: 0;cursor:pointer;color:#e83f44;" onclick="delselling()">注销！</a>


                    {/if} {/if}

                    <!-- <span style="color:#e83f44">欢迎您！</span>{$Think.session.member_phone} <a style="margin: 0;cursor:pointer;color:#e83f44;" onclick="delselling()">注销！</a> -->
                    {/if}

                </span>
            </span>
        </div>
    </div>
    <div style="height: 50px;"></div>
    <div>
        <div class="Navigation">

            <div class="logo">
                <img src="__STATIC__/assets/images/logo2.png" alt="">
            </div>

            <div id="Navigation_content" class="Navigation_content">
                <ul>
                    <li class="li_1">
                        <a href="{:url('Index/index')}">首页</a>
                    </li>
                    <li class="li_2">
                        <a href="{:url('Class/index')}">分类</a>
                    </li>
                    <li class="li_3">
                        <a href="{:url('House/index')}">晒家</a>
                    </li>
                    <li class="li_4">
                        <a href="{:url('Ferr/index')}">免息莫愁</a>
                    </li>
                    <li class="li_5">
                        <a href="{:url('About/index')}">关于我们</a>
                    </li>
                </ul>
            </div>

            <div class="search_box">
                <input type="text" name="" id="ssk" placeholder="搜索">
                <div class="ssbut">
                    <i class="layui-icon">&#xe615;</i>
                </div>

            </div>
            <!-- <div class="search_ssk">
                <input id="ss_text" type="text">
                <a class="glyphicon glyphicon-search" id="ssanniu"></a>
            </div> -->

        </div>
    </div>
</nav>
{include file="public/login"}
<script>
    function delselling() {
        $.ajax({
            type: "POST",
            url: "{:url('Login/delselling')}",
            beforeSend: function () {
                layer.load(0, {
                    shade: false
                });
            },
            success: function (msg) {
                if (msg == 1) {
                    layer.msg('已注销登录!', {
                        icon: 1
                    });
                    history.go(0);
                }

            },
            complete: function () {
                layer.closeAll('loading');
            }
        });
    }

    function register_to() {
        layer.open({
            type: 1,
            title: '莫愁商城',

            skin: 'demo-class', //加上边框
            area: ['432px', '515px'], //宽高
            content: $('#register_form'),
            end: function () {
                $("#register_form").hide();
            }
        });
    }


    function login() {
        //页面层
        layer.open({
            type: 1,
            title: '莫愁商城',
            skin: 'demo-class', //加上边框
            area: ['432px', '515px'], //宽高
            content: $('#login_form'),
            end: function () {
                $("#login_form").hide();
            }
        });
    }


    function register() {
        $('#login_go').hide();
        $('#register_go').show();
        // $
    }

    function login_to() {
        $('#login_go').show();
        $('#register_go').hide();
    }


    function login_res() {
        $('#login_go_to').show();
        $('#register_go_to').hide();
    }

    function register_res() {
        $('#login_go_to').hide();
        $('#register_go_to').show();
        // $
    }

    // 注册一
    function go_register_to() {
        var formData = $("#formpost_register").serialize();
        // console.log(formData);
        $.ajax({
            type: "POST",
            url: "{:url('Login/register')}",
            data: formData, // 要提交的表单 
            beforeSend: function () {
                layer.load(0, {
                    shade: false
                });
            },
            success: function (msg) {
                console.log(msg);
                if (msg == 1) {
                    layer.msg('恭喜您，注册成功！', {
                        icon: 1
                    });
                    $('#login_go').show();
                    $('#register_go').hide();
                } else if (msg == 2) {
                    layer.msg('注册失败，请重试');
                } else if (msg == 3) {
                    layer.msg('验证码错误，请重试！');
                }
                // if (msg == 1111) {
                //     layer.msg('已通过!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                //     history.go(0); 
                // }else{
                //     layer.msg('申请失败,请重新再试!');
                // }
            },
            complete: function () {
                layer.closeAll('loading');
            }
        });


    }

    // 注册二
    function go_register() {
        var formData = $("#formpost_register_to").serialize();
        // console.log(formData);
        $.ajax({
            type: "POST",
            url: "{:url('Login/register')}",
            data: formData, // 要提交的表单 
            beforeSend: function () {
                layer.load(0, {
                    shade: false
                });
            },
            success: function (msg) {
                console.log(msg);
                if (msg == 1) {
                    layer.msg('恭喜您，注册成功！', {
                        icon: 1
                    });
                    $('#login_go_to').show();
                    $('#register_go_to').hide();
                } else if (msg == 2) {
                    layer.msg('注册失败，请重试');
                } else if (msg == 3) {
                    layer.msg('验证码错误，请重试！');
                }
                // if (msg == 1111) {
                //     layer.msg('已通过!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                //     history.go(0); 
                // }else{
                //     layer.msg('申请失败,请重新再试!');
                // }
            },
            complete: function () {
                layer.closeAll('loading');
            }
        });


    }


    // 验证码一
    function code(t) {
        $('#go_code').disabled = true;

        var phone = $('#code_phone').val();
        console.log(phone);
        if (phone == '' || phone.length < 11 || phone.length > 11 || !(
                /^((\d{3}-\d{8}|\d{4}-\d{7,8})|(1[3|5|7|8][0-9]{9}))$/.test(phone))) {
            layer.msg('请输入正确的手机号码');
        } else {
            for (i = 1; i <= t; i++) {
                window.setTimeout("update_p(" + i + "," + t + ")", i * 1000);
            }

            $.ajax({
                type: "POST",
                url: "{:url('Login/verification')}",
                data: {
                    'phone': phone
                }, // 要提交的表单 
                beforeSend: function () {
                    layer.load(0, {
                        shade: false
                    });
                },
                success: function (msg) {
                    console.log(msg);
                    if (msg == 1) {
                        layer.msg('短信已发送', {
                            icon: 1
                        });
                    } else if (msg == 2) {
                        layer.msg('注册失败，请重试！');
                    } else if (msg == 4) {
                        layer.msg('请不要重复发送短信！');
                    } else if (msg == 5) {
                        layer.msg('手机号码已存在！');
                    }
                },
                complete: function () {
                    layer.closeAll('loading');
                }
            });
        }

    }

    function update_p(num, t) {
        if (num == t) {
            $('#go_code').html('获取短信验证码');
            $('#go_code').css("color", "#007bbb");
            $('#go_code').disabled = false;
            $('#go_code').css("pointer-events", "auto");
        } else {
            printnr = t - num;
            // document.myform.phone.value = " (" + printnr +")秒后重新发送";
            $('#go_code').html(" " + printnr + "秒后重新发送");
            $('#go_code').css("color", "#ccc");
            $('#go_code').css("pointer-events", "none");
        }
    }


    // 验证码二
    function codeto(t) {
        $('#go_code_to').disabled = true;

        var phone = $('#code_phone_to').val();
        console.log(phone);
        if (phone == '' || phone.length < 11 || phone.length > 11 || !(
                /^((\d{3}-\d{8}|\d{4}-\d{7,8})|(1[3|5|7|8][0-9]{9}))$/.test(phone))) {
            layer.msg('请输入正确的手机号码');
        } else {
            for (i = 1; i <= t; i++) {
                window.setTimeout("update_po(" + i + "," + t + ")", i * 1000);
            }

            $.ajax({
                type: "POST",
                url: "{:url('Login/verification')}",
                data: {
                    'phone': phone
                }, // 要提交的表单 
                beforeSend: function () {
                    layer.load(0, {
                        shade: false
                    });
                },
                success: function (msg) {
                    console.log(msg);
                    if (msg == 1) {
                        layer.msg('短信已发送', {
                            icon: 1
                        });
                    } else if (msg == 2) {
                        layer.msg('注册失败，请重试！');
                    } else if (msg == 4) {
                        layer.msg('请不要重复发送短信！');
                    } else if (msg == 5) {
                        layer.msg('手机号码已存在！');
                    }
                },
                complete: function () {
                    layer.closeAll('loading');
                }
            });
        }

    }

    function update_po(num, t) {
        if (num == t) {
            $('#go_code_to').html('获取短信验证码');
            $('#go_code_to').css("color", "#007bbb");
            $('#go_code_to').disabled = false;
            $('#go_code_to').css("pointer-events", "auto");
        } else {
            printnr = t - num;
            // document.myform.phone.value = " (" + printnr +")秒后重新发送";
            $('#go_code_to').html(" " + printnr + "秒后重新发送");
            $('#go_code_to').css("color", "#ccc");
            $('#go_code_to').css("pointer-events", "none");
        }
    }


    // // 登录一
    function go_login() {
        var formData = $("#login_formpost").serialize();
        //  // console.log(formData);
        $.ajax({
            type: "POST",
            url: "{:url('Login/login_add')}",
            data: formData, // 要提交的表单 
            beforeSend: function () {
                layer.load(0, {
                    shade: false
                });
            },
            success: function (msg) {
                console.log(msg);
                if (msg == 1) {
                    layer.msg('登录成功！', {
                        icon: 1
                    });
                    history.go(0);
                } else if (msg == 2) {
                    layer.msg('您还没有注册,请前往注册！');
                } else {
                    layer.msg('密码错误,请重新登录！');
                }
                // if (msg == 1111) {
                //     layer.msg('已通过!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                //     history.go(0); 
                // }else{
                //     layer.msg('申请失败,请重新再试!');
                // }
            },
            complete: function () {
                layer.closeAll('loading');
            }
        });
    }


    // 登录二
    function go_login_to() {
        var formData = $("#login_formpost_to").serialize();
        // console.log(formData);
        $.ajax({
            type: "POST",
            url: "{:url('Login/login_add')}",
            data: formData, // 要提交的表单 
            beforeSend: function () {
                layer.load(0, {
                    shade: false
                });
            },
            success: function (msg) {
                // console.log(msg);
                if (msg == 1) {
                    layer.msg('登录成功！', {
                        icon: 1
                    });
                    history.go(0);
                } else if (msg == 2) {
                    layer.msg('您还没有注册,请前往注册！');
                } else {
                    layer.msg('密码错误,请重新登录！');
                }
                // if (msg == 1111) {
                //     layer.msg('已通过!ヾ(o◕∀◕)ﾉ 好棒~', {icon: 1});
                //     history.go(0); 
                // }else{
                //     layer.msg('申请失败,请重新再试!');
                // }
            },
            complete: function () {
                layer.closeAll('loading');
            }
        });
    }
</script>


<!--     <div class="head_left">
        <div>
            <p>购物指南</p>
            <ul>
                <li><a id="head_left_a1" href="../sjdinggou/sjdinggou.html">· 订购流程</a></li>
                <li><a id="head_left_a2" href="../sjzhifu/sjzhifu.html">· 支付方式</a></li>
            </ul>
        </div>
        <div>
            <p>购物保障</p>
            <ul>
                <li><a id="head_left_a3" href="../sjpinpai/sjpinpai.html">· 品牌保障</a></li>
                <li><a id="head_left_a4" href="../sjzhuce/sjzhuce.html">· 注册协议</a></li>
                <li><a id="head_left_a5" href="../sjyinsi/sjyinsi.html">· 隐私保护</a></li>
            </ul>
        </div>
        <div>
            <p>常见问题</p>
            <ul>
                <li><a id="head_left_a6" href="../sjyanhuo/sjyanhuo.html">· 验货签收</a></li>
                <li><a id="head_left_a7" href="../sjshouhuo/sjshouhuo.html">· 交货方式</a></li>
                <li><a id="head_left_a8" href="../sjtuihuo/sjtuihuo.html">· 退货说明</a></li>
            </ul>
        </div>
    </div>
 -->